package com.baseandroid.config;

import android.support.annotation.Keep;

import com.baseandroid.utils.DESedeEncrypt;
import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;


@Keep
public class Constant {

    public static final int WEB_SUCCESS = 200;

    public static final long TIME_ONE_SECOND = 1000;
    public static final long TIME_ONE_MINITUE = 60000;
    public static final long TIME_ONE_HOUR = 3600000;

    public static final int VALIDETE_CODE_WATING_TIME_MAX = 60;

    public static String ANDROIDVERSION = "ANDROID_MERCHANT_VERSION";
    public static String BUSINESS_OUTSIDE_PARAM = "BUSINESS_OUTSIDE_PARAM";
    public static String QRCODE_ACCOUNT = "QRCODE_ACCOUNT" ;
    public static String DEPOSITTOPAY = "DEPOSIT_TO_PAY" ;

    /*--login error---*/
    public static final String ERROR_LOGOUT1 = "40008201";
    public static final String ERROR_LOGOUT2 = "40009201";

    /**
     * 常见的日期格式
     */
    public static final String DATE_YYYY_MM_DD = "yyyy-MM-dd" ;
    public static final String DATE_YYYYMMDD = "yyyyMMdd" ;
    public static final String DATE_MMDD = "MM-dd" ;
    public static final String DATE_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss" ;
    public static final String BALANCE_DEFAULT_DAY = "2017-01-01" ;     //对账单默认查询的最早时间

    /**
     * 收银明细选择状态
     */
    public static final String ORDER_STATUS_ALL = "97";
    public static final String ORDER_STATUS_SUCCESS = "2";
    public static final String ORDER_STATUS_OTHER = "98";
    public static final String ORDER_TYPE_ALL = "99";
    public static final String ORDER_TYPE_QIANBAO = "4" ;
    public static final String ORDER_TYPE_WEIXIN = "3" ;
    public static final String ORDER_TYPE_ZHIFUBAO = "2" ;
    public static final String ORDER_TYPE_CARD = "1";
    public static final String ORDER_TYPE_BHH = "6" ;

    /**
     * 分页请求常量
     */
    public static final int DEFAULT_PAGE_SIZE = 20;
    public static final String DEFAULT_PAGE_NUM = "0" ;

    /**
     * 默认二维码寄送费3元，转化成分
     */
    public static final String DEFAULT_QR_MONEY = "1" ;

    /**
     * 收银明细交易状态交易状态
     */
    public static final String TRADE_SUCCESS = "2" ;
    public static final String TRADE_FAIL    = "3" ;
    public static final String TRADE_UNDO    = "4" ;
    public static final String TRADE_DEALING = "5" ;
    public static final String TRADE_IMPACT  = "6" ;
    public static final String TRADE_IMPACT_FAIL = "7" ;
    public static final String TRADE_UNDO_SUCCESS = "8" ;
    public static final String TRADE_UNDO_FAIL = "9" ;

    /**
     * 支付渠道
     */
    public static final String PAY_WAY_ALI    = "4" ;
    public static final String PAY_WAY_WECHAT = "5" ;
    public static final String PAY_WAY_BHH  = "6" ;
    public static final String PAY_WAY_BANK  = "7" ;

    /**
     * 1：预计到账日期（结算汇总页导出），2：交易日期（账单查询页导出）
     * 1:二维码列表页 2:二维码申请页保存
     */
    public static final String SETTLE_TYPE = "1" ;
    public static final String HISTORY_TYPE = "2" ;

    public static final String PAYING = "paying" ;
    public static final String PAY_SUCCESS = "3";
    public static final String PAY_FAILED = "2";


    /**
     * 北京接口需要通过这一步进行加密操作
     * @param map
     * @return
     */
    public static HashMap<String, String> encryptMap(Map<String,String> map){
        String desedeStr = "";
        try {
            desedeStr = DESedeEncrypt.encrypt("zm39nfhzKZ7EC4AskZSM1UBtDtlXJZ0I", new Gson()
                    .toJson(map));
        } catch (Exception e) {
            e.printStackTrace();
        }
        HashMap<String, String> paraMap = new HashMap<>();
        paraMap.put("context", desedeStr);
        return paraMap ;
    }
}